<template>
  <div id="versionList">
    <el-table :data="versionData" stripe style="width: 100%">
        <el-table-column prop="id"             label="序号"     width="80"></el-table-column>
        <el-table-column prop="channelText"    label="客户端"   width="80"></el-table-column>
        <el-table-column prop="version"        label="版本号"   width="80"></el-table-column>
        <el-table-column prop="phoneType"      label="操作系统" width="100"></el-table-column>
        <el-table-column prop="isFocusUpdateText"     label="强制更新" width="120"></el-table-column>
        <el-table-column prop="name"           label="标题"     width="150"></el-table-column>
        <el-table-column prop="description"    label="描述"     width="400"></el-table-column>
        <el-table-column prop="LastUpdated"    label="时间"     width="180"></el-table-column>
        <el-table-column prop="operator"       label="操作人"   width="90"></el-table-column>
        <el-table-column                       label="操作"     min-width="230" class="controllBtn" >
            <template scope="scope" >
                <buttonBox :scope="scope" @edit="editVersion"></buttonBox>
            </template>
        </el-table-column>
    </el-table>
    <edit-form v-if="edit" @closeDialog="closeDialog" @updateList="getVersionList" :id="id"></edit-form>
  </div>
</template>
<script>
import editForm from './editForm'
import buttonBox from './_button'
import {getVersionList} from 'api/system'
export default {
  components: {
    buttonBox, editForm
  },
  data () {
    return {
      edit: false,
      id: '',
      versionData: [],
    }
  },
  created () {
    this.getVersionList()
  },
  methods: {
    async getVersionList () {
      try {
        let back = await getVersionList(1);
        back = back.data;
        if (back && back.resultCode === '200') {
          this.versionData = [...back.result];
        } else {
          this.$alert(back.msg);
        }
      } catch (err) {
        this.$alert('请求出错', '提示');
      }
    },
    editVersion (id) {
      this.edit = true;
      this.id = id;
    },
    closeDialog () {
      this.edit = false;
    }
  }
}
</script>
<style lang="less">
   
</style>
